//传入用户id，将其收到的所有留言渲染出来
function getLeaveBoard(userid,boardele) {
    $.ajax({
        url:"board/getUserBoard",
        type:'get',
        datatype:"json",
        data:{userid:userid},
        success:function (result){
            if(result.state==0) {
                popMessage(result.message);
            }
            else {
                boardele.empty();
                var list = result.data.messagelist
                if (list.length === 0) {
                    var nulltext = $(buildHTML('p', '暂无留言', {
                        'class': 'nullnode'
                    }))
                    boardele.append(nulltext)
                }
                else {
                    for (i = 0; i < list.length; i++) {
                        boardele.append(createMessageEle(list[i]));
                    }
                }
            }
        }
    })
}

function createMessageEle(message) {
    var ele = $("<li>\n" +
        "  <div class='messageRecord'> <i class='layui-icon layui-icon-username'></i>" + message.leaver + " <span>发表于" + message.sendTime + "</span></div>\n" +
        "  <p>" + message.content + "</p>" +
        "<div class=\"layui-btn-group\" style='text-align: right;display: block'>\n" +
        "  <button class=\"layui-btn layui-btn-sm\">\n" +
        "    <i class='layui-icon layui-icon-reply-fill'></i>"+message.likeCount+"\n" +
        "  </button>\n" +
        "  <button class=\"layui-btn layui-btn-sm\">\n" +
        "    <i class='layui-icon layui-icon-praise'></i>"+message.commentCount+"\n" +
        "  </button>\n" +
        "</div></div>\n" +
        "</li>")
    ele.id=message.id;
}

function deleteMessageEle() {
    
}